package org.cpoy.ei.session;

import org.cpoy.eims.entity.*;
import java.util.ArrayList;
import java.util.List;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityHome;

@Name("relationshipHome")
public class RelationshipHome extends EntityHome<Relationship> {

	public void setRelationshipId(Integer id) {
		setId(id);
	}

	public Integer getRelationshipId() {
		return (Integer) getId();
	}

	@Override
	protected Relationship createInstance() {
		Relationship relationship = new Relationship();
		return relationship;
	}

	public void load() {
		if (isIdDefined()) {
			wire();
		}
	}

	public void wire() {
		getInstance();
	}

	public boolean isWired() {
		return true;
	}

	public Relationship getDefinedInstance() {
		return isIdDefined() ? getInstance() : null;
	}

	public List<Parent> getParents() {
		return getInstance() == null ? null : new ArrayList<Parent>(
				getInstance().getParents());
	}

}
